import {BasicColumn, FormSchema} from '/@/components/Table';
import {render} from '/@/utils/common/renderUtils';

export enum ConfigPageType {
  JSON = '1',
  CUSTOM = '2'
}

export const searchFormSchema: FormSchema[] = [
  {
    field: 'ifCode',
    label: '接口代码',
    component: 'Input'
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode:'data_use_status',
      placeholder:'请选择支付接口状态'
    }
  }
];

export const columns: BasicColumn[] = [
  {
    title: '接口名称',
    width: 100,
    dataIndex: 'ifName'
  },
  {
    title: '接口代码',
    width: 100,
    dataIndex: 'ifCode',
  },
  {
    title: '状态',
    width: 50,
    dataIndex: 'status',
    customRender: ({text}) => {
      let color = "green"
      if (text == '0') color = '#FFCC33'
      if (text == '1') color = 'green'
      
      return render.renderTag(render.renderDict(text, 'data_use_status'), color)
    }
  },
  {
    title: '创建时间',
    width: 100,
    dataIndex: 'createdAt',
  }
];


export const commonFromSchema : FormSchema[] = [
  {
    field: 'id',
    label: '支付接口配置',
    component: 'Input',
    show: false
  },
  {
    field: "status",
    label: "状态",
    component: "JDictSelectTag",
    required: true,
    // defaultValue: '0',
    componentProps: {
      type: "radio",
      dictCode: "data_use_status"
    }
  },

  {
    field: 'remark',
    label: '备注',
    component: 'InputTextArea'
  }
]

